<template>
	<view class="livedata">
		<view class="header">
			<!-- 头部 -->
			<Header :name="message" />
			<!-- 1111111111
			22222222222222 -->
		</view>
		<view class="body">
			<view class="table1">
				<!-- <uni-table border stripe=false emptyText="暂无更多数据"> -->
				<!-- 表头 -->
				<view class="tbth">
					<!-- <uni-tr> -->
					<view class="tbth_frame">
						<view class="table_th">序号</view>
						<view class="table_th">名称</view>
						<view class="table_th">数值</view>
						<view class="table_th">单位</view>
					</view>
					<!-- </uni-tr> -->
				</view>
				<!-- 表数据 -->
				<view class="tbbody">
					<!-- <uni-tr> -->
					<view class="tbbody_frame" v-for="(item, index) in tableData" :key="index">
						<view class="table_td">{{index}}</view>
						<view class="table_td">{{ item.name }}</view>
						<view class="table_td">{{ item.value }}</view>
						<view class="table_td">{{ item.unit }}</view>
					</view>
					<!-- </uni-tr> -->
				</view>
				<!-- </uni-table> -->
			</view>
		</view>
	</view>
</template>

<script>
	import Header from '../component/Header.vue'
	import {
		post
	} from '../../utils/request001.js'
	export default {
		components: {
			Header
		},
		data() {
			return {
				message: '',
				tableData: [{
						id: 1,
						name: 'Ua1',
						value: '0.01',
						unit: 'V'
					},
					{
						id: 2,
						name: 'Ub1',
						value: '0.02',
						unit: 'V'
					},
					{
						id: 3,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 4,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 5,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 6,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 7,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 8,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 9,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 10,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 11,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 12,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 13,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 14,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 15,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 16,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 17,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 3,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 3,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					}, {
						id: 3,
						name: 'Uc1',
						value: '0.03',
						unit: 'V'
					},
					// ... 其他数据
				],
			};
		},
		onLoad(props) {
			console.log(props);
			this.message = props.name
			const res =  post('/api/auth/jwt/token', {
				username: 19571310176,
				password: 'wlm0403',
				type: 1,
				fingerprint: "就业星",
			})
			console.log(res);
			if (res.status === 200) {
				uni.setStorageSync('token', res.data)
				uni.navigateBack(-1)
			} else {
				this.showModal = true;
				this.modalContent = res.message;
			}
		}
	}
</script>

<style lang="scss">
	* {
		margin: 0;
		padding: 0;
	}

	.livedata {
		// background-color: red;

		.header {}

		.body {
			min-height: 42vh;
			// background-color: red;
			padding-top: 160rpx;

			// 表格样式
			.table1 {
				border: 2px solid #e7923b;
				margin: 0 auto;
				width: 80%;
				font-size: 24rpx;
				line-height: 46rpx;
				// max-height: 42vh;
				// overflow-y: scroll;
				// overflow-x: hidden;

				// 单元格样式
				.tbth {
					.tbth_frame {
						display: flex;
						justify-content: center;
						text-align: center;
						border-bottom: 2px solid #e7923b;

						view {
							height: 46rpx;
							border-right: 2rpx solid black;
						}

						view:first-child {
							flex: 2;
						}

						view:nth-child(2) {
							flex: 3;
						}

						view:nth-child(3) {
							flex: 3;
						}

						view:last-child {
							flex: 2;
							border: none;
						}
					}

				}
			}

			.tbbody {
				width: 100%;
				// background: blanchedalmond;
				overflow-y: scroll;
				height: 38vh;

				.tbbody_frame {
					display: flex;
					justify-content: center;
					text-align: center;
					border-bottom: 2px solid #e7923b;

					view {
						height: 46rpx;
						border-right: 2rpx solid black;
					}


					view:first-child {
						flex: 2;
					}

					view:nth-child(2) {
						flex: 3;
					}

					view:nth-child(3) {
						flex: 3;
					}

					view:last-child {
						flex: 2;
						border: none;
					}
				}

				.tbbody_frame:last-child {
					border: none;
				}

				.tbbody_frame:nth-child(2n+1) {
					background-color: #f2f2f2;
				}
			}

		}

	}
</style>